Skip to content

feat: support search input autocomplete overrides - #1250

Open
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/avoid-password-autocomplete
Open

feat: support search input autocomplete overrides#1250
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/avoid-password-autocomplete

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 27, 2026

Copy link
Copy Markdown

Summary

  • expose autoComplete as a public Select prop and forward it only to the internal search input
  • preserve new-password as the default to retain Chromium native-autocomplete suppression
  • document the compatibility default and cover both default and explicit off paths

The input remains type="text" with role="combobox", preserving the ARIA correction from #1222. Applications affected by password-manager UI can now opt into autoComplete="off" without a TypeScript error or leaking the attribute onto the Select root, while existing consumers retain the established fallback.

Closes #1249.
Closes #768.

Verification

  • exact base 29e9ddac1b8eb3dba4a6681d7c886b542a9d7425: the explicit override regression failed because autoComplete="off" did not reach the input, which still rendered new-password
  • focused Select.test.tsx: 110 tests and 5 snapshots passed
  • TypeScript passed
  • ESLint passed
  • Prettier and git diff --check passed
  • prior full validation on this branch: 21 suites, 437 tests, 21 snapshots; ESM/CJS output and declarations

The initial revision proposed changing the global default to off. Based on maintainer review and the history in #538/#1222, this revision deliberately retains new-password and narrows the change to an opt-in override.

AI assistance disclosure: Codex was used to trace the input prop flow and prior changes, check for duplicate work, implement the regression coverage, and run the validation. I verified the cited behavior locally against the exact commits.

Summary by CodeRabbit

  • 新功能

    • Select 组件新增 autoComplete 配置,可自定义搜索输入框的浏览器自动补全行为。
    • 未指定时,搜索输入框默认使用 new-password,抑制浏览器自动补全提示。
  • 文档

    • 补充 autoComplete 属性的类型、用途及默认值说明。

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@nrps9909 is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1be01c4c-c347-465e-a945-932f7a45729d

📥 Commits

Reviewing files that changed from the base of the PR and between 248073f and 103e4a9.

📒 Files selected for processing (3)
  • README.md
  • src/SelectInput/Input.tsx
  • tests/Select.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

Select 为搜索输入框新增可配置的 autoComplete 属性。该属性支持显式传值,并保留 new-password 作为默认值。类型声明、DOM 属性过滤、文档和测试已同步更新。

Changes

Select autoComplete 支持

Layer / File(s) Summary
autoComplete 属性契约
src/BaseSelect/index.tsx, src/SelectInput/index.tsx
BaseSelectPropsSelectInputProps 新增可选的 autoComplete?: stringautoComplete 不会传递到外层 DOM 元素。
搜索输入框属性解析与验证
src/SelectInput/Input.tsx, tests/Select.test.tsx, README.md
搜索输入框优先使用显式 autoComplete,其次使用上下文值,最后使用 new-password。测试验证默认值和 off 值的转发。README 新增属性说明。

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 103e4

The PR adds an opt-in autocomplete override for the Select search input while preserving the existing default behavior and keeping the attribute off the Select root. With the documented tests and validation passing, no actionable merge-blocking risk remains.

Suggested reviewers: qdyanbing, pareder

Poem

小兔带来 autoComplete,
搜索输入接收新配置。
显式值优先传入,
默认值仍然守候。
外层容器不再携带,
测试与文档同步闪亮。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning PR 满足 issue [#768] 的要求:为 Select 增加类型化的 autoComplete 属性,并仅转发到内部搜索输入框。但根据变更摘要,未提供值时仍回退到 "new-password",README 也记录该默认值。这未满足 issue [#1249] 关于避免使用密码相关 autocomplete 值的主要要求。 将默认 autocomplete 值从 "new-password" 改为 "off",并同步更新 Input 逻辑、README 和测试,确保显式传入的 autoComplete 值仍只应用于内部搜索输入框。
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed 变更范围集中在 Select 的 autoComplete 类型定义、内部输入框转发逻辑、文档和测试,均与 linked issues [#1249] 和 [#768] 直接相关。未发现无关代码变更。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:支持为搜索输入配置 autocomplete 覆盖值。该标题简洁、具体,并与代码、文档和测试变更一致。
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread src/SelectInput/Input.tsx Outdated
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.46%. Comparing base (29e9dda) to head (103e4a9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1250   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files          31       31           
  Lines        1304     1304           
  Branches      451      473   +22     
=======================================
  Hits         1297     1297           
  Misses          7        7           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nrps9909
nrps9909 force-pushed the codex/avoid-password-autocomplete branch from 248073f to cb4c9a3 Compare August 27, 2026 11:30
@nrps9909
nrps9909 force-pushed the codex/avoid-password-autocomplete branch from cb4c9a3 to 103e4a9 Compare August 27, 2026 11:30
@nrps9909 nrps9909 changed the title fix: avoid password autocomplete semantics feat: support search input autocomplete overrides Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconsider autocomplete="new-password" as the default for Select inputs autoComplete in SeletProps

3 participants